package com.example.mam.dto;

import com.fasterxml.jackson.annotation.JsonInclude;

import java.io.Serializable;
import java.util.Objects;
import java.util.Set;

/**
 * @author muncie [muncie.hoo@qq.com]
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class TreeNode implements Serializable {
    private static final long serialVersionUID = 1010117862751760711L;
    private String id;
    private String label;
    private Set<TreeNode> children;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public Set<TreeNode> getChildren() {
        return children;
    }

    public void setChildren(Set<TreeNode> children) {
        this.children = children;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        TreeNode treeNode = (TreeNode) o;
        return Objects.equals(label, treeNode.label);
    }

    @Override
    public int hashCode() {

        return Objects.hash(label);
    }

    @Override
    public String toString() {
        return "TreeNode{" +
                "id='" + id + '\'' +
                ", label='" + label + '\'' +
                ", children=" + children +
                '}';
    }
}
